<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>

    <!--引入 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <!-- 必须先引入vue，  后使用element-ui -->
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <!-- 引入element 的组件库-->
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>

    <!--引入layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1"></script>

    <link rel="stylesheet" href="/admin/js-css/css/listvue.css"  media="all" >



</head>
<body>
<div id="app"  >
    <!-- 公共列表组件 -->
    <list
            ref="listCommon"
    ></list>
</div>
</body>
<script>
    Vue.use(httpVueLoader);

    var vm = new Vue({
        el:"#app",
        components: {
            "list" : httpVueLoader("/admin/html/dataManagement/list.vue")
        },
        data:{
            parmsData : {},
            selectData : [],
            multipleSelection : [],
        },
        created(){
        },
        methods:{
            //批量提交审批
            async piliangsubmitshenpi(){
                this.$confirm('此操作要提交审批, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async() => {
                    load();
                    const res = await postWebCustom(getTableId("2549"),{ids:""+this.multipleSelection});
                    layer.closeAll();
                    top.alert(res.msg);
                    vm.$refs.listCommon.getListdata();
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消提交'
                    });
                });

            },
            //打印审批表
            async printshenpibiao(){
                if(this.multipleSelection.length != 1){
                    top.alert("请选择一条记录！");
                    return ;
                }
                let btn = {
                    btn: ['打印预览', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        win.vm.toPrint();

                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/module/yumenyoutian/tuixiuguanli/print2.html?id="+this.multipleSelection, "65%", "85%", function () {
                }, btn, "待遇审批表打印",{});
            },
            async saveDatamap(data){
                let i = load();
                const res = await postWebCustom(getTableId("2431"),data);
                layer.close(i);
                top.alert(res.msg);
            },

            rowtijiaoshenpin(row){
                this.multipleSelection = [row.id];
                this.addJibenxinxi();
            },

            //提交审批
            async addJibenxinxi(){
                if(this.multipleSelection.length != 1){
                    top.alert("请选择一条记录！");
                    return ;
                }
                let btn = {
                    btn: ['提交审批','保存', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.getData();
                        vm.saveDatamap({jsondata:JSON.stringify(data),sfytjsp:"0"})
                        top.close();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.getData();
                        vm.saveDatamap({jsondata:JSON.stringify(data),sfytjsp:"-1"})
                        return false;
                    }
                    , btn3: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                let res = await queryDataForId(getTableId("2429"),""+this.multipleSelection,{type:"update"});
                if(res.code == 0){
                    top.alert(res.msg);
                    return;
                }
                top.f_layer_open_get("/admin/html/inputCustom/index.html?tableId="+getTableId("2429"), "87%", "85%", function () {
                    vm.$refs.listCommon.getListdata();
                }, btn, "提交审批",res.data);
            },

            async savedata(data){
                let i = top.load();
                const res = await postWebCustom(getTableId("2547"),data);
                top.layer.close(i);
                top.alert(res.msg);
                if(res.code == 1){
                    vm.$refs.listCommon.getListdata();
                }
            },
            async addjibenxinxiInput(data){
                let btn = {
                    btn: ['提交审批','保存', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.getData();
                        if(!win.verification()){
                            return false;
                        }
                        vm.savedata({jsondata:JSON.stringify(data),zt:"0"});
                        top.close();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.getData();
                        if(!win.verification()){
                            return false;
                        }
                        vm.savedata({jsondata:JSON.stringify(data),zt:"-1"});
                        return false;
                    }
                    , btn3: function (index, layero) {

                    }
                };

                const res = await postWebCustom(getTableId("2546"),{aac001:data[0].aac001});
                if(res.code == 0){
                    top.alert(res.msg);
                    return;
                }
                top.f_layer_open_get("/admin/html/inputCustom/index.html?tableId="+getTableId("2429"), "90%", "85%", function () {

                }, btn, "有偿退休人员新增",res.data);
            },

            //新增再就业个人基本信息
            addyouchangselectList() {
                let btn = {
                    btn: ['确定', '取消']
                    , yes: function (index, layero) {
                        //按钮【按钮一】的回调
                        let win = getTopIframe(layero);
                        let data = win.vm.selectData;
                        console.log(data);
                        if (data.length > 1) {
                            top.alert("只能选择一条记录！");
                            return;
                        }
                        if (data.length == 0) {
                            top.alert("请选择一条记录！");
                            return;
                        }
                        vm.addjibenxinxiInput(data);
                        top.layer.closeAll();
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false 开启该代码可禁止点击该按钮关闭
                    }
                };

                top.f_layer_open_get("/admin/html/dataManagement/list.html?tableId=" + getTableId("2313"), "90%", "85%", function () {

                }, btn, "从参保人员中选择人员信息");
            }
        }
    });
</script>
</html>